import {httpRequest} from '@/utils/http';
import { AnnualPlanVO, AnnualPlanForm, AnnualPlanQuery } from '@/api/iot/annualPlan/types';
enum Api {
  root = '/iot/annualPlan',
  list = '/iot/annualPlan/list',
  home = '/iot/annualPlan/home',
}

/**
 * 查询电梯年检计划列表
 * @param query
 * @returns {*}
 */

export function listAnnualPlan(query?: AnnualPlanQuery) {
  return httpRequest.get<AnnualPlanVO[]>({url: Api.list, data: query});
}

/**
 * 查询电梯年检计划详细
 * @param planId
 */
export function getAnnualPlan(planId: string | number) {
  return httpRequest.get<AnnualPlanVO>({url: Api.root + '/' + planId});
}

/**
 * 新增电梯年检计划
 * @param data
 */
export function addAnnualPlan(data: AnnualPlanForm) {
  return httpRequest.post<void>({url: Api.root, data});
}

/**
 * 修改电梯年检计划
 * @param data
 */
export function updateAnnualPlan(data: AnnualPlanForm) {
  return httpRequest.put<void>({url: Api.root, data});
}

/**
 * 删除电梯年检计划
 * @param planId
 */
export function delAnnualPlan(planId: string | number | Array<string | number>) {
  return httpRequest.delete<void>({url: Api.root + '/' + planId});
}
